package com.noahplat.user.mapper;

import com.noahplat.user.pojo.Sconfig;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * 高德地图key值
 *
 * @author 宋彦磊
 * @version 1.0.0
 * @Date: 2021/3/1 15:16
 **/
public interface SconfigMapper extends Mapper<Sconfig> {
    @Select("select id,mapkey,state,type from sys_config where state =#{state} order by id desc limit 0,1 ")
    Sconfig getMapkey(@Param("state") String state,@Param("type") String type);
    @Update("update sys_config set state = #{state} where id = #{id}")
    int updateMapid(@Param("state") String state,@Param("id") Long id);
    @Insert("<script> INSERT INTO sys_config(mapkey,state,type) VALUES <foreach collection = 'list' item='record' separator=','>" +
            "(#{record.mapkey},#{record.state},#{record.type})</foreach></script>")
    int insertMapkey(@Param("list")List<Sconfig> list);
}
